package com.be.beadmin.material.entity;

import com.be.beadmin.common.entity.BaseEntity;
import com.fasterxml.jackson.annotation.JsonManagedReference;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.persistence.*;
import java.util.Date;

/**
 * @Author: Mengyang Zhu
 * @Date: 2023/4/16 21:31
 * @Description: 采购订单详情
 */

@Entity
@Table(name = "T_MM_PurchaseOrderDetail")
@Getter
@Setter
public class PurchaseOrderDetail extends BaseEntity {


    //与PurchaseOrder中的主键对应
    @Column(name = "poIdentification", columnDefinition = "VARCHAR(50) COMMENT '采购订单唯一标识' ")
    private String poIdentification;

    @Column(name = "Po", columnDefinition = "VARCHAR(50) COMMENT '采购订单号' ")
    private String Po;
    @Column(name = "PoItem", columnDefinition = "VARCHAR(50) COMMENT '采购订单行' ")
    private String PoItem;
    @Column(name = "MaterialCode", columnDefinition = "VARCHAR(50) COMMENT '物料编码' ")
    private String MaterialCode;
    @Column(name = "MaterialName", columnDefinition = "VARCHAR(50) COMMENT '物料名称' ")
    private String MaterialName;
    @Column(name = "MaterialType", columnDefinition = "VARCHAR(50) COMMENT '物料类型' ")
    private String MaterialType;
    @Column(name = "MaterialQty", columnDefinition = "int COMMENT '物料数量' ")
    private String MaterialQty;
    @Column(name = "MaterialDesc", columnDefinition = "VARCHAR(200) COMMENT '物料描述' ")
    private String MaterialDesc;
    @Column(name = "MaterialSpec", columnDefinition = "VARCHAR(50) COMMENT '物料规格' ")
    private String MaterialSpec;
    @Column(name = "Brand", columnDefinition = "VARCHAR(50) COMMENT '品牌' ")
    private String Brand;
    @Column(name = "Unit", columnDefinition = "VARCHAR(50) COMMENT '单位' ")
    private String Unit;
    @Column(name = "UndeliveredQty", columnDefinition = "int COMMENT '未交货数量' ")
    private int UndeliveredQty;
    @Column(name = "IsFinished", columnDefinition = "VARCHAR(1) COMMENT '行业务是否关闭' ")
    private String IsFinished;
    @Column(name = "Memo", columnDefinition = "text COMMENT '备注' ")
    private String Memo;

    @Column(name = "ExpectedDeliveryTime", columnDefinition = "datetime COMMENT '预计到货日期' ")
    private Date ExpectedDeliveryTime;

    @JsonManagedReference
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "poIdentification", insertable = false, updatable = false)
    public PurchaseOrder purchaseOrder;

}
